package com.example.crm.service;


import com.example.crm.entity.WorkOrder;
import com.example.crm.repository.WorkOrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class WorkOrderService {
    @Autowired
    private WorkOrderRepository workOrderRepository;

    public List<WorkOrder> findAll() {
        return workOrderRepository.findAll();
    }

    public Optional<WorkOrder> findById(Integer id) {
        return workOrderRepository.findById(id);
    }

    public WorkOrder save(WorkOrder workOrder) {
        return workOrderRepository.save(workOrder);
    }

    public void deleteById(Integer id) {
        workOrderRepository.deleteById(id);
    }

}
